package work4;

import java.util.Scanner;
import java.util.ArrayList;

public class Quetion4 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int a, b, c;
		int x, y;

		System.out.print("士兵1~3报数，最后一个士兵报数为：");
		a = input.nextInt();
		System.out.print("士兵1~5报数，最后一个士兵报数为：");
		b = input.nextInt();
		System.out.print("士兵1~7报数，最后一个士兵报数为：");
		c = input.nextInt();
		System.out.print("人数所在区间为[x,y],(用空格隔开)：");
		x = input.nextInt();
		y = input.nextInt();
		input.close();

		ArrayList<Integer> list = new ArrayList<Integer>();
		int result = 0;
		for (int n = 0; result <= y; n++) {
			result = (a * 70 + b * 21 + c * 15) % 105 + 105 * n;
			if (result >= x && result <= y) {
				list.add(result);
			}
		}
		System.out.printf("总人数可能的值有：%s\n", list.toString());
	}
}
